<?
// Function list_dir will list all the files in a given directory
//
function list_dir($dirname)
   {
   static $result_array = array();
   $handle=@opendir($dirname);
   if ($handle != false) {
        while ($file=readdir($handle))
        {
            // ignore the current and parent directory references ('.' and '..')
            if (0 == strpos($file, '.')) {
                continue;
            }
            $result_array[]=$file;
        }
        closedir ($handle);
   }
   return $result_array;
   }

// Start of code -------
header("Content-type: application/json");
$albumName = $_REQUEST['albumName'];

$imagedir="images/album/" . $albumName;
// get a list of images in the image directory
$array=list_dir($imagedir);

echo "[";
// for each file in the filelist, generate the appropriate HTML table code
foreach ($array as $filename)
  {
  echo "'" . $imagedir . "/" . $filename . "', ";
  }
echo "]";

?>

